package cn.jianyongjie.basic.LoginInterceptor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
* @Description: TODO
* @Author: JianYongJie
* @Version: 1.0
* @Date:  2022/5/10 16:29
*/
@Configuration
public class WebConfigurer implements WebMvcConfigurer {

    // 注册拦截器
    @Autowired
    private LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        registry
                // 注册拦截器
                .addInterceptor(loginInterceptor)
                // 拦截所有
                .addPathPatterns("/**")
                // 放行登录接口
                .excludePathPatterns("/login/**")
                // 放行图形验证码
                .excludePathPatterns("/verifyCode/**")
                // 放行短信验证码
                .excludePathPatterns("/verifyCode/sendSmsCode")
                // 放行fastDfs
                .excludePathPatterns("/fastDfs")
                // 放行手机注册
                .excludePathPatterns("/user/phone/register")
                // 放行邮箱注册
                .excludePathPatterns("/user/mailbox/register")
                // 放行店铺入驻
                .excludePathPatterns("/shop/settlement");
    }
}
